<template>
	<view>
		<uni-nav-bar left-icon="left"  :statusBar="true" titleSize="30px" leftText="返回"  title="项目详情"  @clickLeft="back"  :fixed="true" backgroundColor="#3286ed" color="#fff"/>
	    <view style="background-color: #fff;">
			<view class="list" >
			   <view class="title" >客户姓名：{{information.customerName}}</view>
			   <view class="desc">项目名:{{information.projectName}}</view>
			   <view class="desc">项目联系人:{{information.receiverName}}</view>
			   <view class="desc">负责人:{{information.userName}}</view>
			</view>
		</view>
		<view style="margin-top: 5px;background-color: #fff;">
			<u-cell>
				<template #title>
					<view style="font-size: 14px;color:#c3c3c3">基本信息</view>
				</template>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >客户姓名</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.customerName}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >项目名</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.projectName}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >项目联系人</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.receiverName}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >联系人电话</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.projectTel}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >项目地区域</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.projectArea}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >项目信息来源</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{projectSource}}</text>
				</view>
			</u-cell>
			<u-cell >
				<view slot="title"  >
					<text class="u-cell-text" >项目地址</text>
					<text class="u-cell-text" style="margin-left: 10px;">{{information.projectAddress}}</text>
				</view>
			</u-cell>
		</view>
	
	</view>
</template>

<script>
	import {getDicts} from '@/api/dictionary/index.js'
	import {getProjectInfo} from '@/api/project.js'
	export default {
		data(){
			return {
				information:{},
				projectSourceOptions:[],
				projectSource:''
				
			}
		},
		onLoad(options){
			console.log(options);
			this.initData(options.id)
			this.getProjectSource()
		},
		methods:{
			async initData(id){
				const res=await getProjectInfo(id)
			  console.log(res);
			  this.information=res.data
			},
			back(){
				uni.redirectTo({
					url:'/pages/projectFiling/index'
				})
			},
			// 获取信息来源biz_project_source
           getProjectSource(){
			   getDicts('biz_project_source').then(res=>{
				   this.projectSourceOptions=res.data
				   this.projectSource=this.getValue( this.projectSourceOptions, this.information.projectSource)
			   })
		   },
		   getValue(arr,item){
			   for(var i=0;i<arr.length;i++){
				   if(item==arr[i].dictValue){
					   return arr[i].dictLabel
				   }
			   }
		   }

		}
	}
</script>

<style lang="scss">
	.list{
		padding: 10px;
		.title{
			font-size: 14px;
			font-weight: 600;
		}
		.desc{
			font-size: 12px;
		}
	}
</style>